package com.js.blog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.js.blog.bean.UserPermission;
import com.js.blog.dao.UserPermissionMapper;
import com.js.blog.service.UserPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yanglin
 * @create 2024-03-01 16:21 星期五
 * description:
 */
@Service
public class UserPermissionServiceImpl extends ServiceImpl<UserPermissionMapper, UserPermission> implements UserPermissionService {

    @Autowired
    UserPermissionMapper userPermissionMapper;
    
    /**
     * 根据userId查询用户权限
     */
    @Override
    public List<UserPermission> getByUserId(Long userId) {
        LambdaQueryWrapper<UserPermission> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserPermission::getUserId,userId);
        List<UserPermission> userPermissions = userPermissionMapper.selectList(wrapper);
        return userPermissions;
    }
}
